From 700423f3b662dea36c3375713340e7fa97952331 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Wed, 19 Mar 2008 19:16:50 +0000 Subject: [PATCH] garmin_fs: Entitize XML output (GPX). git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@3150 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/garmin_fs.c | 45 +++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/gpsbabel/garmin_fs.c b/gpsbabel/garmin_fs.c index 3fa634eb4..76a65aa8d 100644 --- a/gpsbabel/garmin_fs.c +++ b/gpsbabel/garmin_fs.c @@ -2,7 +2,7 @@ Implementation of special data used by Garmin products. - Copyright (C) 2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2006, 2007, 2008 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -133,6 +133,7 @@ garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) if (gmsd == NULL) return; + /* Find out if there is at least one field set */ addr = GMSD_GET(addr, ""); if (! *addr) addr = GMSD_GET(city, ""); if (! *addr) addr = GMSD_GET(country, ""); @@ -189,24 +190,42 @@ garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) gbfprintf(ofd, "%*s\n", --space * 2, ""); } if (*addr) { - char *str; + char *str, *tmp; gbfprintf(ofd, "%*s\n", space++ * 2, ""); - if ((str = GMSD_GET(addr, NULL))) - gbfprintf(ofd, "%*s%s\n", space * 2, "", str); - if ((str = GMSD_GET(city, NULL))) - gbfprintf(ofd, "%*s%s\n", space * 2, "", str); - if ((str = GMSD_GET(state, NULL))) - gbfprintf(ofd, "%*s%s\n", space * 2, "", str); - if ((str = GMSD_GET(country, NULL))) - gbfprintf(ofd, "%*s%s\n", space * 2, "", str); - if ((str = GMSD_GET(postal_code, NULL))) - gbfprintf(ofd, "%*s%s\n", space * 2, "", str); + if ((str = GMSD_GET(addr, NULL))) { + tmp = xml_entitize(str); + gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); + xfree(tmp); + } + if ((str = GMSD_GET(city, NULL))) { + tmp = xml_entitize(str); + gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); + xfree(tmp); + } + if ((str = GMSD_GET(state, NULL))) { + tmp = xml_entitize(str); + gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); + xfree(tmp); + } + if ((str = GMSD_GET(country, NULL))) { + tmp = xml_entitize(str); + gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); + xfree(tmp); + } + if ((str = GMSD_GET(postal_code, NULL))) { + tmp = xml_entitize(str); + gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); + xfree(tmp); + } gbfprintf(ofd, "%*s\n", --space * 2, ""); } + if (*phone) { - gbfprintf(ofd, "%*s%s\n", space * 2, "", phone); + char *tmp = xml_entitize(phone); + gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); + xfree(tmp); } gbfprintf(ofd, "%*s\n", --space * 2, ""); -- 2.30.2